package com.bs.manager04.service.impl;

import com.bs.manager04.entity.Userrole;
import com.bs.manager04.mapper.UserroleMapper;
import com.bs.manager04.service.IUserroleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * <p>
 * 用户角色关联表 服务实现类
 * </p>
 *
 * @author yao
 * @since 2022-12-17
 */
@Service
public class UserroleServiceImpl extends ServiceImpl<UserroleMapper, Userrole> implements IUserroleService {

    @Resource
    UserroleMapper mapper;


    @Override
    @Transactional
    public int addRoles(String userid, String[] roleids) {
        mapper.delUserByID(userid);
        int row=mapper.addRoles(userid,roleids);

        return row;
    }
}
